// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import { setupInterceptors } from '@/utils/request'
import { useUserStore } from '@/store/user'
import { useToastStore } from '@/store/toast'

// src/main.js
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.bundle.min.js'
import 'bootstrap-icons/font/bootstrap-icons.css'


const app = createApp(App)
const pinia = createPinia()

app.use(pinia)      // ← 必须先安装 Pinia
app.use(router)     // ← 再安装 Router

// 在 Pinia + Router 安装后，注入拦截器并把 store 访问器传入
setupInterceptors({
  getUserStore: () => useUserStore(),
  getToastStore: () => useToastStore()
})

app.mount('#app')
